<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Messages.ascx.cs" Inherits="controls_Messages" %>
<asp:Repeater ID="msgItems" runat="server">
    <ItemTemplate>
        <div class="msgItem">
           <a <%# string.IsNullOrEmpty(StrongTyped<SimpleGuestbook.Entities.Message>(Container.DataItem).Email) ? "" : "href=mailto:" + StrongTyped<SimpleGuestbook.Entities.Message>(Container.DataItem).Email%>><%# string.IsNullOrEmpty(StrongTyped<SimpleGuestbook.Entities.Message>(Container.DataItem).Nick) ? "Anonymous" : StrongTyped<SimpleGuestbook.Entities.Message>(Container.DataItem).Nick%></a> <span class="postTime">@ <%# StrongTyped<SimpleGuestbook.Entities.Message>(Container.DataItem).PostTime %></span>
           <a href="#" style="display:<%# (Session["Admin"] != null && (bool)Session["Admin"] == true) ? "inline" : "none" %>" onclick="if (window.confirm('Are you sure?')) Ajax.Update('controls/Messages', 'msgContainer', 'option=delete&id='+<%# StrongTyped<SimpleGuestbook.Entities.Message>(Container.DataItem).ID %>+'&pageNo='+$('curPage').innerHTML)">Delete</a>
           <hr />
           <span class="msgContent"><%# Server.HtmlEncode(StrongTyped<SimpleGuestbook.Entities.Message>(Container.DataItem).Content)  %></span><br />
           <span style="display:<%# (!string.IsNullOrEmpty(StrongTyped<SimpleGuestbook.Entities.Message>(Container.DataItem).AdminFeedback)) || (Session["Admin"] != null && (bool)Session["Admin"] == true) ? "inline" : "none" %>">
           -
           <a href="#" style="display:<%# (Session["Admin"] != null && (bool)Session["Admin"] == true) ? "inline" : "none" %>" onclick="var feedbackContent; feedbackContent = window.prompt('Please input feedback content:', '<%# ToJsSingleQuoteSafeString(string.Format("{0}", StrongTyped<SimpleGuestbook.Entities.Message>(Container.DataItem).AdminFeedback)) %>'); if (feedbackContent) Ajax.Update('controls/Messages', 'msgContainer', 'option=feedback&id='+<%# StrongTyped<SimpleGuestbook.Entities.Message>(Container.DataItem).ID %>+'&content='+escape(feedbackContent)+'&pageNo='+$('curPage').innerHTML);">Edit Feedback</a>
           <br />
           <span class="adminFeekback"><%# Server.HtmlEncode(StrongTyped<SimpleGuestbook.Entities.Message>(Container.DataItem).AdminFeedback)  %></span> <span class="postTime">@ <%# StrongTyped<SimpleGuestbook.Entities.Message>(Container.DataItem).AdminFeedbackTime %></span>
           </span>
        </div>
    </ItemTemplate>
</asp:Repeater>
<div class="pageMenu">
    <% 
        if (curPage > 1) {
    %>
          <a href="javascript:$('msgContainer').innerHTML = '<div align=center>Load Messages...</div>'; Ajax.Update2('controls/Messages', 'msgContainer', 'option=page&pageNo=<%= curPage - 1 %>')">Prv. Page</a>
    <% 
        }
    %> 
    <span class="curPage" id="curPage"><%= curPage %></span>/<%= maxPage %>
    <% 
        if (curPage < maxPage) {
    %>
          <a href="javascript:$('msgContainer').innerHTML = '<div align=center>Load Messages...</div>'; Ajax.Update2('controls/Messages', 'msgContainer', 'option=page&pageNo=<%= curPage + 1 %>')">Next Page</a>
    <% 
        }
    %>
</div>
<%= info %>